/* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

OSS相关接口
OSS相关接口

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/

#import <Foundation/Foundation.h>
#import <JDCloudOCSDKOss/OssApiModel.h>


@implementation OssHeadBucketRequest
-(id) initWithRegion:(NSString *)regionId
bucketname:(NSString*)bucketname { 
    self.regionId = regionId;
    self.bucketname = bucketname;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
bucketname:(NSString*)bucketname { 
    self.regionId = regionId;
    self.version = version;
    self.bucketname = bucketname;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self bucketname])
    {
        [result setValue:[self bucketname] forKey:@"bucketname"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.bucketname = [dictionary objectForKey:@"bucketname"];
    return self;
} 

@end
@implementation OssPutBucketRequest
-(id) initWithRegion:(NSString *)regionId
bucketname:(NSString*)bucketname { 
    self.regionId = regionId;
    self.bucketname = bucketname;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
bucketname:(NSString*)bucketname { 
    self.regionId = regionId;
    self.version = version;
    self.bucketname = bucketname;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self bucketname])
    {
        [result setValue:[self bucketname] forKey:@"bucketname"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.bucketname = [dictionary objectForKey:@"bucketname"];
    return self;
} 

@end
@implementation OssDeleteBucketRequest
-(id) initWithRegion:(NSString *)regionId
bucketname:(NSString*)bucketname { 
    self.regionId = regionId;
    self.bucketname = bucketname;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
bucketname:(NSString*)bucketname { 
    self.regionId = regionId;
    self.version = version;
    self.bucketname = bucketname;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self bucketname])
    {
        [result setValue:[self bucketname] forKey:@"bucketname"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.bucketname = [dictionary objectForKey:@"bucketname"];
    return self;
} 

@end
@implementation OssPutBucketResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
@implementation OssDeleteBucketResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
  
@implementation OssDeleteBucketResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
OssDeleteBucketResult* result = [[OssDeleteBucketResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(OssDeleteBucketResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation OssListBucketsResult
-(id) initWithOwner:(User*) owner
        buckets:(NSArray<Bucket*>*)buckets { 
    self.owner = owner;               
    self.buckets = buckets;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self owner])
    {
        [result setValue:[[self owner] dictionary]forKey:@"owner"];
    }
    if([self buckets])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self buckets] count]; i++) {
            Bucket* item = [[self buckets] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"buckets"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.owner = [[User alloc]initWithDic:[dictionary objectForKey:@"owner"]];
    NSArray* bucketsArray = [dictionary objectForKey:@"buckets"];
    if(bucketsArray&&![bucketsArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [bucketsArray count];i++)
        {
        Bucket* item = [[Bucket alloc]initWithDic:[bucketsArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.buckets = propertyArray;
    }
    return self;
} 

@end
  
@implementation OssListBucketsResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
OssListBucketsResult* result = [[OssListBucketsResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(OssListBucketsResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation OssHeadBucketResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
  
@implementation OssHeadBucketResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
OssHeadBucketResult* result = [[OssHeadBucketResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(OssHeadBucketResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
  
@implementation OssPutBucketResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
OssPutBucketResult* result = [[OssPutBucketResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(OssPutBucketResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation OssListBucketsRequest
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
 
